package IO特殊操作流;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/*
* ObjectInputStream 反序列化优先使用ObjectOutputStream编写的原始数据和对象
* ObjectInputStream(InputStream in) 创建从指定的InputStream读取的ObjectInputStream
* 反序列化对象的方法 Object readObject() 从ObjectInputStream读取一个对象
* */
public class 对象反序列化流 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("day10\\oos.txt"));
        Object obj = ois.readObject();
        Student1 s = (Student1) obj;
        System.out.println(s.getName()+","+s.getAge());
        ois.close();
    }
}